package sunyu.quartz.common.job;

import com.jfinal.kit.PropKit;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.quartz.QuartzJobBean;

public class DemoJob extends QuartzJobBean {

    private static final Logger logger = LoggerFactory.getLogger(DemoJob.class);

    private String applicationContextSchedulerContextKey = PropKit.use("config-quartz.properties").get("quartz.applicationContextSchedulerContextKey");

    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        /*try {
            ApplicationContext applicationContext = (ApplicationContext) context.getScheduler().getContext().get(applicationContextSchedulerContextKey);
            logger.info(applicationContext.getBean("dataSource") + "");
        } catch (SchedulerException e) {
            e.printStackTrace();
        }*/

        logger.debug("执行定时任务啦################");
    }
}
